package TokenRecognizer;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author jefoutta
 */
public class NodeExp {
    private Integer position;
    private Integer firstPosition;
    private Integer lastPosition;
    private Sets<Integer> firstPositionSet;
    private Sets<Integer> lastPositionSet;
    private char label;
    private boolean nullable;

    public NodeExp(char tlabel){
        label = tlabel;
        firstPositionSet = new Sets();
        lastPositionSet = new Sets();
    }

    public Integer getFirstPos(){
        return firstPosition;
    }

    public Integer getLastPos(){
        return lastPosition;
    }

    public Integer getPos(){
        return position;
    }

    public char getLabel(){
        return label;
    }

    public Integer getFirstPos(Integer n){
        return firstPositionSet.get(n);
    }

    public Integer getLastPos(Integer n){
        return lastPositionSet.get(n);
    }

    public Sets<Integer> getFirstPosSet(){
        return firstPositionSet;
    }

    public Sets<Integer> getLastPosSet(){
        return lastPositionSet;
    }

    public Integer getFirstPosSize(){
        return firstPositionSet.getSize();
    }

    public boolean getNullable(){
        return nullable;
    }

    public void setFirstPos(Integer n){
        firstPositionSet.add(n);
        firstPosition = n;
    }

    public void setLastPos(Integer n){
        lastPositionSet.add(n);
        lastPosition = n;
    }

    public void setFirstPos(Sets<Integer> tset){
        firstPositionSet.add(tset);
    }

    public void setLastPos(Sets<Integer> tset){
        lastPositionSet.add(tset);
    }

    public void setPos(Integer n){
        position = n;
    }

    public void setLabel(char c){
        label = c;
    }

    public void setNullable(boolean b){
        nullable = b;
    }

    public String toString(){
        return  (firstPositionSet.toString()+ " " +Character.toString(label)+" "+ lastPositionSet.toString());
    }
}
